Fixed Perimeter on a Compound Shape

Drag Point P to show different sizes of the compound shape all having the same perimeter.  The area of the compound shape is plotted against its width in the 2nd Graphics Window.

Perimeter:

Measures

Locus

p = 25 (slider from 0 to 50, step 0.1)
h = Function(0 * x, 0, 2 * p / (2 + π))
P = Point(h)
B = Intersect(xAxis, yAxis)
Per = Textfield(p)
RadTop: 0.5 * Distance[B, P]
side: 0.5 * (p - (2 + π) * RadTop)
D: (x(P), side)
C: (0, side)
c = Semicircle(C, D)
a = Segment(C, B)
b = Segment(B, P)
d = Segment(P, D)
e = Segment(D, C)
E = Midpoint(C, D)
CurvedArea = CircleSector(E, D, C)
RectangularArea, c_1, Width, a_1, d_1 = Polygon(C, B, P, D)
g = Semicircle(C, D)
TotalArea: CurvedArea + RectangularArea
Area: (x(P), TotalArea)
loc1 = Locus(Area, P)
PLocx: (x(Area), 0)
f = Segment(Area, PLocx)
Radius: RadTop
SideHeight: a
text1: "Radius = " + Radius + ""
text2: "Side height = " + SideHeight + ""
i = false
j = false